/**
 * resource.h is part of cbs-framework.
 *
 * cbs-framework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * cbs-framework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with cbs-framework.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef RESOURCE_H
#define RESOURCE_H

#include "../utils/visitor/visitable.h"
#include "../utils/printable.h"
#include "definitions.h"

// Forward declarations.
class Visitor;
class ResourceConstraint;

class Resource : public Visitable, public Printable
{
public:

    Resource( const std::string & a_resourceName = UNNAMED_RESOURCE );

    virtual ~Resource();

    virtual void Accept( Visitor * a_visitor );

    virtual std::string Print() const;

    void ResourceName( const std::string & a_resourceName );

    const std::string & ResourceName() const;

    void Add( ResourceConstraint * a_constraint );

private:

    // Fields
    // ------

    std::string          m_resourceName;
    tResourceConstraints m_constraints;

    static const std::string UNNAMED_RESOURCE;

    // Methods
    // -------

    void ClearConstraints();

    std::string PrintConstraints() const;

    void VisitConstraints( Visitor * a_visitor );

    // Protect default copy constructor.
    Resource( const Resource & a_other );

    // Protect default operator =.
    Resource & operator = ( const Resource & a_other );
};

#endif // RESOURCE_H
